<%@page import="dao.UserManager"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Virtual Intranet Library</title>
</head>
<body>
	<%@include file='home.jsp'%>
	<% if(!user.isAdmin()){
    response.sendRedirect("home.jsp");
    return;
}%>
	<% List<User> users=UserManager.fetchAllUsers();
if(!users.isEmpty()){
    %>
	<table border=1>
		<tr>
			<th>Username</th>
			<th>Name</th>
			<th>Surname</th>
			<th>E-mail</th>
			<th>Workplace</th>
			<th>Allowed items</th>
			<th>Admin</th>
		</tr>
		<%for(User currentUser : users){%>
		<tr>
			<td><%=currentUser.getUsername()%></td>
			<td><%=currentUser.getName()%></td>
			<td><%=currentUser.getSurname()%></td>
			<td><%=currentUser.getEmail()%></td>
			<td><%=currentUser.getWorkplace()%></td>
			<td><%=currentUser.getMaxItems()%></td>
			<td><%=currentUser.isAdmin()?"Yes":"No"%></td>
		</tr>
		<% }%>
	</table>
	<%} %>
</body>
</html>